home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
aminet
/
dev
/
lang
/
sbp3_1e.lzh
/
CAPITALS.PL
< prev
next >
Wrap
Text File
|
1991-10-31
|
953b
|
34 lines
/* From the book PROLOG PROGRAMMING IN DEPTH
by Michael A. Covington, Donald Nute, and Andre Vellino.
Copyright 1988 Scott, Foresman & Co.
Non-commercial distribution of this file is permitted. */
/* CAPITALS.PL */
/* Example of a program that starts computation
automatically upon being consulted */
/* Quintus Prolog prints a warning at the end of the consultation
because of the fail statement */
capital_of(georgia,atlanta).
capital_of(california,sacramento).
capital_of(florida,tallahassee).
capital_of(connecticut,hartford).
print_a_capital :- capital_of(State,City),
write(City),
write(' is the capital of '),
write(State),
nl.
print_capitals :- print_a_capital,
fail.
/* In some Prologs, change ":-" to "?-" below */
:- nl,
write('The following are some states and their capitals:'),
nl,
nl,
print_capitals.